#include <iostream>
using namespace std;

class polygon
{
    public:
        polygon(): width(0), height(0){};
        polygon(int w, int h): width(w), height(h){};
        int getwidth();
        int getheight();
        virtual int area() = 0; // Abstract Class (Never Used)
    protected:
        int width, height;
};

class rect: public polygon
{
    public:
        int area(){return width * height;};
        rect(int w, int h);
};

rect::rect(int w, int h)
{
    width = w;
    height = h;
}

class tri: public polygon
{
    public:
        int area(){return width * height / 2;};
        tri(int w, int h);
};

tri::tri(int w, int h)
{
    width = w;
    height = h;
}

int main()
{
    rect r(5,10);
    cout << r.area() << endl;
    tri t(2,6);
    cout << t.area() << endl;
    rect rect_point(2,4);
    polygon * pointing = &rect_point;
    cout << pointing->area() << endl;
    /*
    polygon is now an abstract class so this will no longer work
    ************************************************************
    polygon s(7,3);
    cout << s.getheight() << endl;
    ************************************************************
    */
    int j;
    cout << (j = 5) << endl;
}
